<script setup>
import { useI18n } from 'vue-i18n'
defineProps({
  btnText: {
    type: String,
    default: ''
  },
  text: {
    type: String,
    default: ''
  },
  className: {
    type: String,
    default: ''
  },
  btnProps: {
    type: Object,
    default: () => {
      return {}
    }
  }
})
const emit = defineEmits(['comfirmHandle'])

const { t } = useI18n()

const handlePositiveClick = () => {
  emit('comfirmHandle')
}
</script>

<template>
  <n-popconfirm
    @positive-click="handlePositiveClick"
    :positive-text="t('system.confirmText')"
    :negative-text="t('system.cancelText')"
  >
    <template #trigger>
      <n-button v-bind="btnProps" :class="className">{{
        btnText ? btnText : t('system.delete')
      }}</n-button>
    </template>

    {{ text ? text : t('system.deleteTip') }}
  </n-popconfirm>
</template>

<style scoped></style>
